package song.demo.servicelmpl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import song.demo.bean.UserBean;
import song.demo.mapper.UserMapper;
import song.demo.service.UserService;

import javax.annotation.Resource;
import java.util.List;

@Service
public class UserServicelmpl implements UserService {

    //将DAO注入Service层
    @Resource
    private UserMapper userMapper;

    @Override
    public UserBean login(String name, String password) {
        return userMapper.getInfo(name, password);
    }
    //获取所有用户
    @Override
    public List<UserBean> getAllUser() {
        return userMapper.getAllUser();
    }
    //插入用户
    @Override
    public int insertUser(UserBean userBean) {
        return userMapper.insertUser(userBean);
    }
    //删除用户
    @Override
    public int deleteUser(String id) {
        return userMapper.deleteUser(id);
    }
    //查找指定id用户
    @Override
    public UserBean getUserById(String id) {
        return userMapper.getUserById(id);
    }
    //修改用户信息
    @Override
    public int updateUser(UserBean userBean) {
        return userMapper.updateUser(userBean);
    }
}
